<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
		<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/scriptvalidator.js" type="text/javascript"></script>
		<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
		<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script language='javascript'>
		function checkSubmit(){
	     	var staffForm = document.form1;
			if(!Validator.Validate(staffForm, 3)) {
				return false;
			}

			return true;
		 }
		function show(id,ui){
			var url = "<s:property value='contextPath'/>/pm/user/choose.do?currentPage=${currentPage}&pmId="+id+"&id="+ui;
			window.open(url, "newwindow", "height=500, width=600, toolbar =no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
		}
		function openPass(id,area){
			this.doAjaxTest(area);
			if(bo){
				var searchForm = document.form1;
				searchForm.action = "<s:property value='contextPath'/>/pm/user/opPass.do?currentPage=${currentPage}";
				searchForm.submit();
			}
		}
		var bo = true;
		function doAjaxTest(area){
			area = encodeURI(area); 
			area = encodeURI(area); 
				$.ajax({
					  async:false,
					  type: 'POST',
					  url:"<s:property value='contextPath'/>/pm/user/ifYouBe.do?msg="+area+"",
					  dataType: "json",
					  success: function(data) {
						  if(data){
							  alert("本月已发布人员名单,或者区域冲突，请重新生成"); 
							  bo = false;
						  }
					  }
					});
			
		}
		function jumpPage(page) {
			var searchForm = document.form1;
			searchForm.action = "<s:property value='contextPath'/>/pm/user/edit.do?currentPage=" + page;
			searchForm.submit();
		} 
		</script>
</head>
<body>
<div class="navigation">
	    <span><a href="javascript:window.history.back();"><img src="${contextPath}/images/back_nav_btn.png" /></a>
	    <a href="javascript:window.history.back();">返回</a>
	    <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
	     <a href="javascript:window.history.forward();">前进</a>
	    <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
	     <a href="javascript:window.location.reload();">刷新</a>
	    </span>绩效管理&gt;&gt;名单管理&gt;&gt;名单编辑
    </div>
<div class="xt_main_right_center">
<form name="form1" method="post" onSubmit="return checkSubmit();" action="edit.do?brand.id=${brand.id }">
<input type="hidden" name="redirectUrl" value='<s:property value='redirectUrl'/>'/>
  <table width="100%" border="0">
  <tr>
      <td class="left-td-width-bg" align="right">发布人：</td>
      <td class="right-td-width-bg-left"> ${pmUser.author.realName } </td>
      <td class="left-td-width-bg" align="right">发布时间：</td>
      <td class="right-td-width-bg-left"> ${pmUser.deliveryTime } </td>
    </tr>
      <tr>
      <td class="left-td-width-bg" align="right">发布月份：</td>
      <td class="right-td-width-bg-left"> <s:date name="pmUser.deliveryTime" format="yyyy-MM"/> </td>
      <td class="left-td-width-bg" align="right">区域：</td>
      <td class="right-td-width-bg-left"> ${pmUser.area }  </td>
      
    </tr>
  </table>
  	<input type="hidden" name="id" value="${pmUser.id }">
  </form>
  </div>
   <table width="100%" border="0">
    <tr>
      <td align="right">&nbsp;</td>
      <td colspan="2" align="right">&nbsp;</td>
    </tr>
    <tr>
      <td align="left"><font color="#0066CC"><strong>人员列表：</strong></font></td>
      <td colspan="2" align="right"></td>
    </tr>
  </table>
  <table  width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" align="center">
    <tr>
      <td class="top-td-width-bg">序号</td>
      <td class="top-td-width-bg">4S店</td>
      <td class="top-td-width-bg">驻店顾问</td>
      <td class="top-td-width-bg">所属区域</td>
      <td class="top-td-width-bg">操作</td>
    </tr>
        <s:iterator value="page.result" status="i" id="b">
    <tr>
      <td class="down-center-td-width-bg">${i.count }</td>
      <td class="down-center-td-width-bg">${b.shop.shopName }</td>
      <td class="down-center-td-width-bg">
      	<s:iterator value="users" status="t" id="c">
      	${c.realName }&nbsp;&nbsp;
      	</s:iterator>
      </td>
      <td class="down-center-td-width-bg">${b.organization.name }</td>
      <td class="down-center-td-width-bg"><a href="javascript:show('${b.id }','${pmUser.id }');"><img src="${contextPath}/images/edit.gif" alt="编辑" width="16" height="13" border="0" /></a></td>
    </tr>
    </s:iterator>
     <tr>
      <td class="down-center-td-width-bg" colspan="13" align="right"> <%@ include file="/WEB-INF/view/common/pagination.jsp"%></td>
    </tr>
  </table>
   <table  width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" align="center">
   <tr>
      <td align="center" class="top-td-width-bg"><label>
        <input type="button" name="button3" onClick="openPass('${pmUser.id }','${pmUser.area }');" id="button2" value="发布">
      </label></td>
     </tr>
   </table>
  
  <br/><br/><br/><br/><br/>
		<div><jsp:include page="/include/footer.inc"></jsp:include></div>
</body>
</html>